<?php

namespace App\Admin\Actions;

use Encore\Admin\Actions\RowAction;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Http\Request;

class AuthContent extends RowAction
{
    public $name = '审核';

    public function handle(Model $model, Request $request)
    {
        $result = $request->get('result');
        $model->status = $result;
        $model->save();
        return $this->response()->success('审核成功')->refresh();
    }

    public function form()
    {
        $this->radio('result','审核选择')
            ->options([
                1 => '审核通过',
                -1 => '审核不通过'
            ]);
    }

}